package webgamemaker.Editor;

import webgamemaker.Common.Callback;
import webgamemaker.Common.MapData;

import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;

public class AddTileSetWindow extends Window
{
	public AddTileSetWindow(final MapData map)
	{
		setTitle("add tileset");
		setIsModal(true);
		setShowModalMask(true);
		centerInPage();
		setWidth(120);  
		setHeight(100); 
		DynamicForm form = new DynamicForm();  
		form.setHeight100();  
		form.setWidth100();  
		form.setPadding(5);  
		form.setLayoutAlign(VerticalAlignment.BOTTOM);  
		ButtonItem newTileSet = new ButtonItem("newTileset"); 
		newTileSet.setTitle("new tileset");
		newTileSet.addClickHandler(new ClickHandler()
			{
				public void onClick(ClickEvent event) 
				{
					AddTileSetWindow.this.destroy();
					new CreateTileSetWindow(map).show();
				}
				
			});
		ButtonItem existingTileSet = new ButtonItem("existingTileset");  
		existingTileSet.setTitle("existing tileset");
		existingTileSet.addClickHandler(new ClickHandler()
		{
			public void onClick(ClickEvent event) 
			{
				AddTileSetWindow.this.destroy();
				final FileNavigatorWindow win = new FileNavigatorWindow(".");
				win.addCallback(new Callback()
					{
						public void onCall(Object src) 
						{
							
						}
					});
				win.show();
			}
			
		});
		form.setFields(newTileSet, existingTileSet);
		addItem(form);
	}
}
